#ifndef __UTIL_H__
#define __UTIL_H__

#include <stdint.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <string>
#include <vector>
#include <execinfo.h>

namespace sylar
{

/// @brief 
/// @return 
pid_t GetThreadId();

uint32_t GetFiberId();


// 堆栈，层，越过几层
void Backtrace(std::vector<std::string>& bt, int size, int skip = 1);


std::string BacktraceToStrig(int size = 64, int skip = 0, const std::string& message = " ");

//时间 ms
uint64_t GetCurrentMs();
uint64_t GetCurrentUs();

}

#endif